\(\int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx\) [4]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 10, antiderivative size = 17 \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=-\frac {\text {arctanh}(\cos (x)) \sin (x)}{\sqrt {a \sin ^2(x)}} \]

[Out]

-arctanh(cos(x))*sin(x)/(a*sin(x)^2)^(1/2)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3286, 3855} \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=-\frac {\sin (x) \text {arctanh}(\cos (x))}{\sqrt {a \sin ^2(x)}} \]

[In]

Int[1/Sqrt[a*Sin[x]^2],x]

[Out]

-((ArcTanh[Cos[x]]*Sin[x])/Sqrt[a*Sin[x]^2])

Rule 3286

Int[(u_.)*((b_.)*sin[(e_.) + (f_.)*(x_)]^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Di
st[(b*ff^n)^IntPart[p]*((b*Sin[e + f*x]^n)^FracPart[p]/(Sin[e + f*x]/ff)^(n*FracPart[p])), Int[ActivateTrig[u]
*(Sin[e + f*x]/ff)^(n*p), x], x]] /; FreeQ[{b, e, f, n, p}, x] &&  !IntegerQ[p] && IntegerQ[n] && (EqQ[u, 1] |
| MatchQ[u, ((d_.)*(trig_)[e + f*x])^(m_.) /; FreeQ[{d, m}, x] && MemberQ[{sin, cos, tan, cot, sec, csc}, trig
]])

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\sin (x) \int \csc (x) \, dx}{\sqrt {a \sin ^2(x)}} \\ & = -\frac {\text {arctanh}(\cos (x)) \sin (x)}{\sqrt {a \sin ^2(x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.76 \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\frac {\left (-\log \left (\cos \left (\frac {x}{2}\right )\right )+\log \left (\sin \left (\frac {x}{2}\right )\right )\right ) \sin (x)}{\sqrt {a \sin ^2(x)}} \]

[In]

Integrate[1/Sqrt[a*Sin[x]^2],x]

[Out]

((-Log[Cos[x/2]] + Log[Sin[x/2]])*Sin[x])/Sqrt[a*Sin[x]^2]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(48\) vs. \(2(15)=30\).

Time = 0.72 (sec) , antiderivative size = 49, normalized size of antiderivative = 2.88

method result size
default \(-\frac {\sin \left (x \right ) \sqrt {a \left (\cos ^{2}\left (x \right )\right )}\, \ln \left (\frac {2 \sqrt {a}\, \sqrt {a \left (\cos ^{2}\left (x \right )\right )}+2 a}{\sin \left (x \right )}\right )}{\sqrt {a}\, \cos \left (x \right ) \sqrt {a \left (\sin ^{2}\left (x \right )\right )}}\) \(49\)
risch \(-\frac {2 \ln \left ({\mathrm e}^{i x}+1\right ) \sin \left (x \right )}{\sqrt {-a \left ({\mathrm e}^{2 i x}-1\right )^{2} {\mathrm e}^{-2 i x}}}+\frac {2 \ln \left ({\mathrm e}^{i x}-1\right ) \sin \left (x \right )}{\sqrt {-a \left ({\mathrm e}^{2 i x}-1\right )^{2} {\mathrm e}^{-2 i x}}}\) \(64\)

[In]

int(1/(a*sin(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-sin(x)*(a*cos(x)^2)^(1/2)/a^(1/2)*ln(2*(a^(1/2)*(a*cos(x)^2)^(1/2)+a)/sin(x))/cos(x)/(a*sin(x)^2)^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 36 vs. \(2 (15) = 30\).

Time = 0.27 (sec) , antiderivative size = 70, normalized size of antiderivative = 4.12 \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\left [\frac {\sqrt {-a \cos \left (x\right )^{2} + a} \log \left (-\frac {\cos \left (x\right ) - 1}{\cos \left (x\right ) + 1}\right )}{2 \, a \sin \left (x\right )}, \frac {\sqrt {-a} \arctan \left (\frac {\sqrt {-a \cos \left (x\right )^{2} + a} \sqrt {-a} \cos \left (x\right )}{a \sin \left (x\right )}\right )}{a}\right ] \]

[In]

integrate(1/(a*sin(x)^2)^(1/2),x, algorithm="fricas")

[Out]

[1/2*sqrt(-a*cos(x)^2 + a)*log(-(cos(x) - 1)/(cos(x) + 1))/(a*sin(x)), sqrt(-a)*arctan(sqrt(-a*cos(x)^2 + a)*s
qrt(-a)*cos(x)/(a*sin(x)))/a]

Sympy [F]

\[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\int \frac {1}{\sqrt {a \sin ^{2}{\left (x \right )}}}\, dx \]

[In]

integrate(1/(a*sin(x)**2)**(1/2),x)

[Out]

Integral(1/sqrt(a*sin(x)**2), x)

Maxima [A] (verification not implemented)

none

Time = 0.46 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.53 \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\frac {\sqrt {-a} {\left (\arctan \left (\sin \left (x\right ), \cos \left (x\right ) + 1\right ) - \arctan \left (\sin \left (x\right ), \cos \left (x\right ) - 1\right )\right )}}{a} \]

[In]

integrate(1/(a*sin(x)^2)^(1/2),x, algorithm="maxima")

[Out]

sqrt(-a)*(arctan2(sin(x), cos(x) + 1) - arctan2(sin(x), cos(x) - 1))/a

Giac [A] (verification not implemented)

none

Time = 0.36 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.88 \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{\sqrt {a} \mathrm {sgn}\left (\sin \left (x\right )\right )} \]

[In]

integrate(1/(a*sin(x)^2)^(1/2),x, algorithm="giac")

[Out]

log(abs(tan(1/2*x)))/(sqrt(a)*sgn(sin(x)))

Mupad [F(-1)]

Timed out. \[ \int \frac {1}{\sqrt {a \sin ^2(x)}} \, dx=\int \frac {1}{\sqrt {a\,{\sin \left (x\right )}^2}} \,d x \]

[In]

int(1/(a*sin(x)^2)^(1/2),x)

[Out]

int(1/(a*sin(x)^2)^(1/2), x)